package com.controller;

import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletResponse;

import org.apache.ibatis.session.SqlSession;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.CookieValue;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.dao.chaxunDao;
import com.util.sqlSessionFactory;

@Controller
public class chaxunController {
	private Map<String, Object> result;
	@RequestMapping(value="/querymonth.action",method=RequestMethod.GET)
	@ResponseBody
	public Map<String,Object> querymonth(
			@CookieValue(value="user",defaultValue="")String userId,
			HttpServletResponse response){
		    SqlSession session = sqlSessionFactory.getSqlSession();
		    chaxunDao dao = session.getMapper(chaxunDao.class);
		    Map<String, Object> result = dao.querymonth(userId);
		    session.commit();
				return result;
				}
	@RequestMapping(value="/querykindzc.action",method=RequestMethod.GET)
	@ResponseBody
	public List<Map> querykindzc(
			@CookieValue(value="user",defaultValue="")String userId,
			HttpServletResponse response
			){
		SqlSession session = sqlSessionFactory.getSqlSession();
	    chaxunDao dao = session.getMapper(chaxunDao.class);
	    List<Map> result = dao.querykindzc(userId);
	    session.commit();
		return  result;	
	}
	@RequestMapping(value="/querykindsr.action",method=RequestMethod.GET)
	@ResponseBody
	public List<Map> querykindsr(
			@CookieValue(value="user",defaultValue="")String userId,
			HttpServletResponse response
			){
		SqlSession session = sqlSessionFactory.getSqlSession();
	    chaxunDao dao = session.getMapper(chaxunDao.class);
	    List<Map> result = dao.querykindsr(userId);
	    session.commit();
		return  result;
	}
}
